import axios from 'axios'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
NProgress.configure({ showSpinner: false });
let instance = axios.create({
    baseURL: '/mock',
    timeout: 20000
})

instance.interceptors.request.use((config) => {

    NProgress.start()
    return config
})
instance.interceptors.response.use((response) => {
    NProgress.done()
    return response.data
}, (error) => {
    NProgress.done()
    return Promise.reject(error)
})

export default instance